package zheezes.util;

public class IntUtil {
	public static final int cutLow(int num, int bn) {
		int base = (int) Math.pow(10, bn);
		return (num / base) * base;
	}

	public static final int cutHigh(int num, int bn) {
		int base = (int) Math.pow(10, bn);
		return num % base;
	}
	
	public static final int parse(String str) {
		int radix = 0;
		
		str = str.trim();
		if(str.startsWith("0x")) {
			str = str.substring(2);
			radix = 16;
		} else {
			radix = 10;
		}
		
		return Integer.parseInt(str, radix);
	}
	
	public static void main(String[] args) {
		System.out.println(parse("16"));
	}
}
